package com.testscripts;

    import org.apache.commons.io.FileUtils;
import org.apache.xpath.operations.String;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
    public class ShotScreen {  
      
        /** 
         * @Quinty's Test 
         * @throws IOException  
         * @throws InterruptedException  
         */  
        public static void main(String[] args) throws IOException, InterruptedException {  
          System.setProperty("webdriver.chrome.driver","C:\\Documents and Settings\\Administrator\\Local Settings\\Application Data\\Google\\Chrome\\Application\\chromedriver.exe");
            WebDriver driver = new ChromeDriver();  
            driver.get("http://www.baidu.com");  
                      
         
            Thread.sleep(5000);  
          
            File screenShotFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);  
            FileUtils.copyFile(screenShotFile, new File("D:/test.png"));}}  